package dhu.cst.jnlwt.jiangnan181310209liwanting181310302.tally.activity_tally;

import androidx.appcompat.app.AppCompatActivity;

import android.content.Intent;
import android.graphics.Typeface;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;

import dhu.cst.jnlwt.jiangnan181310209liwanting181310302.tally.R;

public class HomeActivity extends AppCompatActivity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_home);

        LinearLayout ll_bill = findViewById(R.id.ll_bill);
        LinearLayout ll_record = findViewById(R.id.ll_record);
        LinearLayout ll_user = findViewById(R.id.ll_user);

        ll_bill.setOnClickListener(this);
        ll_record.setOnClickListener(this);
        ll_user.setOnClickListener(this);

        TextView title = findViewById(R.id.appName_home);
        Typeface typeface = Typeface.createFromAsset(getAssets(),"myFont.ttf");
        title.setTypeface(typeface);

        Log.d("tag","HomeActivity create");
    }

    @Override
    public void onClick(View v) {
        String phoneNumber = getIntent().getStringExtra("phone_toHA");
        switch ((v.getId())){
            //点击底部导航栏的账单选项，跳转至账单界面
            case R.id.ll_bill:
                Intent intent1 = new Intent(HomeActivity.this, BillActivity.class);
                intent1.putExtra("phone_toBA",phoneNumber);
                startActivity(intent1);
                break;
            //点击底部导航栏的记账选项，跳转至记账界面
            case R.id.ll_record:
                Intent intent2 = new Intent(HomeActivity.this, RecordActivity.class);
                intent2.putExtra("phone_toRA",phoneNumber);
                startActivity(intent2);
                break;
            //点击底部导航栏的我的选项，跳转至用户界面
            case R.id.ll_user:
                Intent intent3 = new Intent(HomeActivity.this,UserActivity.class);
                intent3.putExtra("phone_toUA",phoneNumber);
                startActivity(intent3);
                break;
            default:
                break;
        }
    }


    @Override
    public void finish() {
        super.finish();
        Log.d("tag","HomeActivity finish");
    }
}